package com.example.vv.frameWork.mvp;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import com.example.vv.R;
import com.example.vv.frameWork.base.BaseActivity;
import com.example.vv.frameWork.base.BaseFragment;
import com.example.vv.frameWork.base.BaseView;

import butterknife.ButterKnife;

public abstract class MvpActivity<V extends BaseView,P extends MvpPresenter> extends BaseActivity {
    protected P presenter;
    public abstract int initLayout();
    public abstract P initPresenter();
    public abstract void initView();
    public abstract  void initData();
    public abstract void doBusiness();
    public abstract View titleVIew();
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            setBarColor(titleVIew());
        presenter=initPresenter();
        presenter.attach((V)this);
        setContentView(initLayout());
        ButterKnife.bind(this);
        initView();
        initData();
        doBusiness();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.detach();
    }
}